﻿using CloudStorageLight.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CloudStorageLight.Core.Web
{
    public class CloudSettingsVM
    {
        public bool AzureAdMode { get; set; }
        public string Authority { get; set; }
        public string CloudStorageLightClientId { get; set; }
        public string CloudStorageLightAppKey { get; set; }
        public string TenantId { get; set; }
        public string RmsServicePrincipal{ get; set; }
        public string RmsSymmetricKey { get; set; }
        public string RmsExtranetUrl { get; set; }
        public string RmsIntranetUrl { get; set; }
        public string Administrators { get; set; }
        public string AllowIPAddresses { get; set; }
        public bool UseClientTokenForIPCheck { get; set; }
        public string AcceptMailAddressPattern { get; set; }
        public string GuestMailAddressPattern { get; set; }
        public string ClientDownloadPage { get; set; }

        public bool CanFullTextSearch { get; set; }
        public bool CanCreateSelfAccount { get; set; }
        public bool CanUseBackupFunction { get; set; }
        public bool CanUseAutoPassword { get; set; }
        public bool CanUseUserPasswordProtect { get; set; }
        public bool CanUseRMS { get; set; }
        public bool CanUseGuestAccount { get; set; }
        public bool CanUseTransferFile { get; set; }

        public bool IsLocked { get; set; }

        public double? AuthTicketTimeout { get; set; }

        public int LogRetentionDays { get; set; }

        public string AuthFtpServer { get; set; }

        public string AuthFtpDomain { get; set; }

        public CloudSettingsVM()
        {
        }

        public CloudSettingsVM(CloudAccount account)
        {
            this.AzureAdMode = account.AzureAdMode;
            this.Authority = account.Authority;
            this.CloudStorageLightClientId = account.CloudStorageLightClientId;
            this.CloudStorageLightAppKey = account.CloudStorageLightAppKey;
            this.AcceptMailAddressPattern = account.AcceptMailAddressPattern;
            this.GuestMailAddressPattern = account.GuestMailAddressPattern;
            this.TenantId = account.TenantId;
            this.RmsServicePrincipal = account.RmsServicePrincipal;
            this.RmsSymmetricKey = account.RmsSymmetricKey;
            this.RmsExtranetUrl = account.RmsExtranetUrl;
            this.RmsIntranetUrl = account.RmsIntranetUrl;
            this.Administrators = account.Administrators;
            this.ClientDownloadPage = account.ClientDownloadPage;
            this.CanFullTextSearch = account.CanFullTextSearch;
            this.CanCreateSelfAccount = account.CanCreateSelfAccount;
            this.CanUseBackupFunction = account.CanUseBackupFunction;
            this.CanUseAutoPassword = account.CanUseAutoPassword;
            this.CanUseUserPasswordProtect = account.CanUseUserPasswordProtect;
            this.CanUseRMS = account.CanUseRMS;
            this.CanUseGuestAccount = account.CanUseGuestAccount;
            this.IsLocked = account.IsLocked;
            this.AllowIPAddresses = account.AllowIPAddresses;
            this.UseClientTokenForIPCheck = account.UseClientTokenForIPCheck;
            this.CanUseTransferFile = account.CanUseTransferFile;
            this.AuthTicketTimeout = account.AuthTicketTimeout;
            this.LogRetentionDays = account.LogRetentionDays;
            this.AuthFtpServer = account.AuthFtpServer;
            this.AuthFtpDomain = account.AuthFtpDomain;
        }
    }
}